<template>
  <!-- 放入头部组件 -->
  <navbar title="免责声明"></navbar>
  <!-- contain -->
  <view class="contain">
    <view class="title">免责声明</view>
    <view class="information">
      <view class="informationDetail" v-for='(item, index) of disclaimerData' :key="index">
        <text>{{item}}</text>
      </view>
    </view>

  </view>
</template>

<script setup>
  import navbar from '@/components/navbar/navbar.vue'
  import {
    ref
  } from 'vue'
  import {
    onLoad
  } from '@dcloudio/uni-app'
  import {
    disclaimer
  } from '@/api/person.js'
  const disclaimerData = ref([])
  onLoad(() => {
    disclaimer('disclaimer').then((res) => {
      if (res.code === 200) {
        res.data.forEach((item) => {
          if (item && item.content) {
            disclaimerData.value.push(removeHtmlTags(item.content))
          }
        })
      }
    })
  })
  const removeHtmlTags = (html) => {
    if (!html) return ''
    let text = html.replace(/<[^>]+>/g, '')
    text = text.replace(/\s+/g, ' ').trim()
    return text
  }
</script>

<style lang="scss" scoped>
  .header {
    color: #fff;
    font-size: 36rpx;
  }

  :deep(.right-content) {
    margin-right: 75rpx;
  }

  .contain {
    margin: 30rpx 30rpx 0 30rpx;
    font-family: Source Han Sans CN;
    font-weight: normal;
    font-stretch: normal;
    align-items: center;
    justify-content: center;

    .title {
      text-align: center;
      font-size: 42rpx;
      font-weight: 700;
      line-height: 60rpx;
      letter-spacing: -1rpx;
      color: #333333;
    }

    .information {
      margin-top: 46rpx;
      border-top: #f5f5f5 2px solid;

      .informationDetail {
        font-size: 32rpx;
        line-height: 56rpx;
        letter-spacing: 0rpx;
        color: #333333;
        margin-top: 42rpx;
      }
    }
  }
</style>